#ifndef __OPENC_H__
#define __OPENC_H__

#include <stddef.h>
#include <stdint.h>

typedef struct {
    uint32_t* pixels;
    int width;
    int height;
    int stride;
} openc_canvas_t;

openc_canvas_t openc_make_canvas(uint32_t* pixels, int width, int height);

void openc_render_point(openc_canvas_t* canvas, int x, int y, uint32_t color);

void openc_draw_line(openc_canvas_t* canvas, int x1, int y1, int x2, int y2, uint32_t color);
void openc_draw_rect(openc_canvas_t* canvas, int x0, int y0, int w, int h, uint32_t color);
void openc_draw_circle(openc_canvas_t* canvas, int cx, int cy, int r, uint32_t color);
void openc_draw_triangle(openc_canvas_t* canvas, int x1, int y1, int x2, int y2, int x3, int y3, uint32_t color);

void openc_fill(openc_canvas_t* canvas, uint32_t color);
void openc_fill_rect(openc_canvas_t* canvas, int x0, int y0, int w, int h, uint32_t color);
void openc_fill_circle(openc_canvas_t* canvas, int cx, int cy, int r, uint32_t color);
void openc_fill_triangle(openc_canvas_t* canvas, int x1, int y1, int x2, int y2, int x3, int y3, uint32_t color);

typedef int error_t;
error_t openc_save_to_ppm_file(openc_canvas_t* canvas, const char* filepath);

#endif // __OPENC_H__